<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>

</body>
<script>
	// Function.prototype.myBind = function(content,...arg){
	// 	const _this = this;// _this---->fn
	// 	return function(...arg2){
	// 		if(content === null || content === undefined){
	// 			content = window;
	// 		}else if(typeof content !== "object" && typeof content !== "function"){
	// 			content = new Object(content);
	// 		}
	// 		const key = Math.random().toString(36).slice(2);
	// 		content[key] = _this;
	// 		// content[key](...arg,...arg2);
	// 		// content[key](...[...arg,...arg2]);
	//
	//
	// 		delete content[key];
	// 	}
	// }
	
	
	Function.prototype.myBind = function(content){
		const _this = this;// _this---->fn
		const arg1 = Array.from(arguments).slice(1);
		return function(){
			if(content === null || content === undefined){
				content = window;
			}else if(typeof content !== "object" && typeof content !== "function"){
				content = new Object(content);
			}
			const arg2 = Array.from(arguments);
			const arg = arg1.concat(arg2);
			const key = Math.random().toString(36).slice(2);
			content[key] = _this;
			console.log("content[key]("+arg.join(",")+")")
			eval("content[key]("+arg.join(",")+")")
			delete content[key];
		}
	}
	function fn(a,b,c,d,e){
		console.log("fn",this,a,b,c,d,e);
	}
	fn.myBind({},1,2)(100,200,300);
</script>
</html>